﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.IO;

namespace HF.Software.ClassLib
{
    public class IniWrite
    {
        INIHelper INIUnit;
        public IniWrite(string fileName)
        {
            if (!File.Exists(this.sIniFilePath + @"\" + fileName)) return;

            INIUnit = new INIHelper(System.IO.Path.Combine(System.Windows.Forms.Application.StartupPath, fileName));
        }

        public IniWrite()
        {
            if (!File.Exists(this.sIniFilePath + @"\Config.INI")) return;
            INIUnit = new INIHelper(System.IO.Path.Combine(System.Windows.Forms.Application.StartupPath, "Config.INI"));
        }

        public void Write(string IN_Section, string IN_Key, string IN_Value)
        {
            if (!File.Exists(this.sIniFilePath + @"\Config.INI")) return;
            //INIUnit = new INIHelper(System.IO.Path.Combine(System.Windows.Forms.Application.StartupPath, "Config.INI"));
            INIUnit = new INIHelper(this.sIniFilePath + @"\Config.INI");
            INIUnit.SetKeyValue(IN_Section, IN_Key, IN_Value);
        }

        private string sIniFilePath = System.Windows.Forms.Application.StartupPath;
    }


    public class IniModelDataCollection : List<IniModel>
    {
    }

    public class IniModel
    {
        private string _IN_Section;
        /// <summary>
        /// 
        /// </summary>
        public string IN_Section
        {
            get { return _IN_Section; }
            set { _IN_Section = value; }
        }

        private string _IN_Key;
        /// <summary>
        /// 
        /// </summary>
        public string IN_Key
        {
            get { return _IN_Key; }
            set { _IN_Key = value; }
        }

        private string _IN_Value;
        /// <summary>
        /// 
        /// </summary>
        public string IN_Value
        {
            get { return _IN_Value; }
            set { _IN_Value = value; }
        }
    }




}
